class User < ActiveRecord::Base

  has_many :comments
  has_many :posts
  has_many :contents
  has_many :enrollments
  has_many :answers
  has_many :courses
 
  validates_presence_of(:name)
  validates_presence_of(:login)
  validates_presence_of(:password)
  validates_presence_of(:type)
  validates_uniqueness_of(:login)
  validates_length_of(:login, :minimum => 3)
  validates_length_of(:login, :maximum => 20)
  validates_length_of(:password, :minimum => 3)
  validates_length_of(:password, :maximum => 20)
  
  validates_confirmation_of(:password)

end
